<%@page import="beans.Coursebean"%>
<%@page import="dao.Course"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
		    + request.getServerName() + ":" + request.getServerPort()
		    + path + "/";
%>
<%
    Coursebean coursebean = new Coursebean();
    Course course = (Course) session.getAttribute("course");
    int counts = course.getChaptercounts();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>章节知识预览</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
body {
	font: normal 16px auto "Trebuchet MS", Verdana, Arial, Helvetica,
		sans-serif;
	color: #4f6b72;
	text-align: left;
	background: #E6EAE9;
}

#container {
	margin-left: auto;
	margin-right: auto;
	width: 1280px;
	height: 800px;
	background: #f8f8f8;
	display: block;
	vertical-align: middle;
}

.ele {
	margin-top: 30px;
	margin-botton: 30px;
	text-align: left;
	width: 100%;
	display: block;
	vertical-align: middle;
}
</style>
</head>
<body>
	<div id="container">
		<c:choose>
			<c:when test="<%=counts <=0 %>">
				<c:out value="科目信息有误，没有相应章节信息"></c:out>
			</c:when>
			<c:otherwise>
				<div class="ele">
					<h3><%=course.getName()%></h3>
					<%
					    for (int i = 0; i < counts; i++) {
								StringBuffer idString = new StringBuffer();
								if (i < 9) {
								    idString.append("0").append(i + 1);
								} else {
								    idString.append(i + 1);
								}
					%>
					<a
						href="./common/chapter.jsp?chapterid=<%=course.getCourseid() + idString.toString()%>">第<%=i + 1%>章</a>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<%
					    if ((i + 1) % 5 == 0) {
								    out.write("<br>");
								}
							    }
					%>
				</div>
			</c:otherwise>
		</c:choose>
	</div>
</body>
</html>
